﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Emgu.CV;

namespace TestEmguCV
{
    public partial class Form1 : Form
    {
        private const string video_url = "rtsp://admin:zckj888888@192.168.1.64:554/h264/ch1/sub/av_stream";
        VideoCapture capture;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            capture = new VideoCapture(video_url);
            capture.ImageGrabbed += Capture_ImageGrabbed;
            capture.Grab();
            capture.Start();
        }

        private void Capture_ImageGrabbed(object sender, EventArgs e)
        {
            Mat image = new Mat();
            capture.Retrieve(image);
            picCAM.Image = image.ToBitmap();
        }
    }
}
